<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title></title>
    <%@ include file="/WEB-INF/include/commoncss.jsp"%>
    <script type="text/javascript"
            src="${ctx}/javascript/laydate/laydate.js"></script>
</head>
<body>
<article class="page-container">
    <div action="" class="form form-horizontal" id="scheduleAdd">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span
                    class="c-red">*</span>中文国名：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input id="nation_z" name="nation_z" value="${society.nation_z}" class="input-text" disabled/>
            </div>

        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span
                    class="c-red">*</span>人口：</label>
            <div class="formControls col-xs-8 col-sm-3">
                <input type="text" name="population" id="population" class="input-text" value="${society.population}"/>
            </div>
            <label class="form-label col-xs-4 col-sm-2"><span
                    class="c-red">*</span>统计年份：</label>
            <div class="formControls col-xs-8 col-sm-3">
                <input type="text" name="census_time" id="census_time" class="input-text" value="${society.census_time}"/>
            </div>

        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">统计报表：</label>
            <div class="formControls col-xs-8 col-sm-3">
                <input placeholder="用逗号隔开" type="text" name="statistics" id="statistics" class="input-text" value="${society.statistics}"/>
            </div>
            <label class="form-label col-xs-4 col-sm-2">相关文献：</label>
            <div class="formControls col-xs-8 col-sm-3">
                <input placeholder="用逗号隔开" type="text" name="conferences" id="conferences" class="input-text" value="${society.conferences}"/>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">民族：</label>
            <div class="formControls col-xs-8 col-sm-3">
                <textarea id="nation" name="nation" cols="130" rows="5">${society.nation}</textarea>
            </div>

        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">婚姻制度：</label>
            <div class="formControls col-xs-8 col-sm-3">
                <textarea id="marriage_system" name="marriage_system" cols="130" rows="5" value="" >${society.marriage_system}</textarea>
            </div>

        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">宗教信仰：</label>
            <div class="formControls col-xs-8 col-sm-3">
                <textarea id="religion" name="religion" cols="130" rows="5" value="" >${society.religion}</textarea>
            </div>

        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">重要节庆：</label>
            <div class="formControls col-xs-8 col-sm-3">
                <textarea id="festival" name="festival" cols="130" rows="5" value="" >${society.festival}</textarea>
            </div>

        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">人民生活：</label>
            <div class="formControls col-xs-8 col-sm-3">
                <textarea id="people_livelihood" name="people_livelihood" cols="130" rows="5" value="" >${society.people_livelihood}</textarea>
            </div>

        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">新闻出版：</label>
            <div class="formControls col-xs-8 col-sm-3">
                <textarea id="news_publish" name="news_publish" cols="130" rows="5" value="" >${society.news_publish}</textarea>
            </div>

        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">
                <span class="c-red">*</span>来源：</label>
            <div class="formControls col-xs-8 col-sm-3">
                <textarea id="reference" name="reference" cols="130" rows="5" value="" >${society.reference}</textarea>
            </div>

        </div>
        <div class="row cl">
            <div class="col-xs-8  col-xs-offset-5 ">
                <button value="${society.country_code}" type="button" class="btn btn-success radius" onClick="update_politic(this.value)">提交</button>
                &nbsp;&nbsp;&nbsp;&nbsp;
                <button id="close" value="${society.recoder_id}" onClick="layer_close();" class="btn btn-default radius" type="button"> 关闭</button>
            </div>
        </div>
    </div>
    <%@ include file="/WEB-INF/include/commonjs.jsp"%>
    <script>
        function update_politic(value){
            var recorder=document.getElementById("close").value;
            var YHZH=parent.parent.document.getElementById("YHZH").innerText;
            if(YHZH.substring(0,3)!='001'&&YHZH.substring(0,3)!=recorder){
                layer.msg("你不能修改不是别人的内容只能查看",{icon:2,time:2000});
                return;
            }
            var conferences=document.getElementById("conferences").value;
            var statistics=document.getElementById("statistics").value;
            var population=document.getElementById("population").value;
            var census_time=document.getElementById("census_time").value;
            var nation=document.getElementById("nation").value;
            var marriage_system=document.getElementById("marriage_system").value;
            var religion=document.getElementById("religion").value;
            var festival=document.getElementById("festival").value;
            var people_livelihood=document.getElementById("people_livelihood").value;
            var news_publish=document.getElementById("news_publish").value;
            var reference=document.getElementById("reference").value;
            if(((population!=null&&population!="")&&(census_time==null||census_time==""))
                ||((population==null||population=="")&&(census_time!=null&&census_time!=""))){
                layer.msg("人口和年份必须同时填写或都不填",{icon:2,time:2000});
                return;
            }
            else if(reference==""||reference==null){
                layer.msg("*为必填项",{icon:2,time:2000});
                return;
            }
            layer.confirm("确认提交吗",{btn:['确定','取消']},function(){

                var url="${ctx}/Society/society_update.do";
                var parameter={statistics:statistics,conferences:conferences,population:population,census_time:census_time,nation:nation,marriage_system:marriage_system
                    ,religion:religion,festival:festival,country_code:value,people_livelihood:people_livelihood
                    ,reference:reference ,news_publish:news_publish};
                $.post(url,parameter,function(data){
                    if(data=="修改成功"){
                        layer.msg(data,{icon:1,time:2000},function(){
                            parent.location.reload(true);
                        })
                    }else{
                        layer.msg(data,{icon:2,time:2000});
                    }
                })
            })
        }

    </script>
</article>


</body>

</html>